Rectangle 27 3

About the carrier: Running your code on the simulator gives me nil while running on a device correctly says 2011-11-24 10:49:05.182 testapp[12579:707] Carrier Name: Vodafone.de, so the code is absolutely correct (running on iOS 5.0.1 using Xcode 4.2). Maybe your carrier didn't fill out some field correctly? In any case I would consider testing on another device or with another SIM card.

Concerning signal strength: As CTGetSignalStrength seems to be a rather undocumented API the values may be arbitrarily defined by Apple (and redefined as well). In any case this seems to be a RSSI value (received signal strength indication) which is more or less a positive number where 1 is the worst signal strength and upper is better. As such there is no predefined (documented and thus stable) available mapping to dBm values, a mapping would probably have to be created experimentally.

i dont think CTGetSignalStength in RSSI form, since i learn how to convert it to dBm, its not match with dBm iphone shown.

objective c - get carrier name and signal strength return wrong value ...

iphone objective-c iphone-privateapi signal-strength
Rectangle 27 2

You can only achieve this with private API calls. There is a list on google code with all the functions related to 802.11 devices. Apple80211GetInfoCopy should be the one you're looking for.

But remember that you will not get this into the AppStore...

I have edited. Can you please have a look at the code

This goes very much into basics. First of all you should read the documentation on how to add frameworks to your project (in a nutshell). Then import the class with #import <CoreTelephony/CoreTelephony> and you should be all set.

ios - Is there a way to get Signal Strength from Iphone? - Stack Overf...

ios iphone signal-strength
Rectangle 27 2

You can only achieve this with private API calls. There is a list on google code with all the functions related to 802.11 devices. Apple80211GetInfoCopy should be the one you're looking for.

But remember that you will not get this into the AppStore...

I have edited. Can you please have a look at the code

This goes very much into basics. First of all you should read the documentation on how to add frameworks to your project (in a nutshell). Then import the class with #import <CoreTelephony/CoreTelephony> and you should be all set.

ios - Is there a way to get Signal Strength from Iphone? - Stack Overf...

ios iphone signal-strength
Rectangle 27 2

It is quite common that signal strength values are returned as integer numbers. The tricky point is the mapping to the corresponding dBm value. Usually the int values provide a resolution of 0.5, 1, or 2 dBm. The dBm values reported by the handset/modem usually range from -115 to -51 dBm for 2G (GSM/EDGE) and -120 to -25 dBm for 3G (UMTS/HSxPA) and represent the RSSI (received signal strength indicator).

E.g. the Android API uses the default 3GPP mapping (see Android reference).

Please take also into account that the baseband modem differs between the iPhone 4S (Qualcomm) and earlier models which used an Infineon Gold.

as of iOS 5.0 at least, iPhone is not using the same 3GPP mapping, unfortunately. I ran the code, and got values outside the range 0..31,99.

Yes, both iPhone 4 (Infineon) and iPhone 4S (Qualcomm) use an internal mapping of signal strength. Furthermore, some values (e.g. 0 and 11) seem to be reported in case not network connection is available (modem switched off or coverage hole).

objective c - get carrier name and signal strength return wrong value ...

iphone objective-c iphone-privateapi signal-strength
Rectangle 27 1

You can only achieve this with private API calls. There is a list on google code with all the functions related to 802.11 devices. Apple80211GetInfoCopy should be the one you're looking for.

But remember that you will not get this into the AppStore...

I have edited. Can you please have a look at the code

This goes very much into basics. First of all you should read the documentation on how to add frameworks to your project (in a nutshell). Then import the class with #import <CoreTelephony/CoreTelephony> and you should be all set.

ios - Is there a way to get Signal Strength from Iphone? - Stack Overf...

ios iphone signal-strength
Rectangle 27 21

First, you have to split the signal in small frames with 10 to 30ms, apply a windowing function (humming is recommended for sound applications), and compute the fourier transform of the signal. With DFT, to compute Mel Frequecy Cepstral Coefficients you have to follow these steps:

import numpy
from scipy.fftpack import dct
from scipy.io import wavfile

sampleRate, signal = wavfile.read("file.wav")
numCoefficients = 13 # choose the sive of mfcc array
minHz = 0
maxHz = 22.000  

complexSpectrum = numpy.fft(signal)
powerSpectrum = abs(complexSpectrum) ** 2
filteredSpectrum = numpy.dot(powerSpectrum, melFilterBank())
logSpectrum = numpy.log(filteredSpectrum)
dctSpectrum = dct(logSpectrum, type=2)  # MFCC :)

def melFilterBank(blockSize):
    numBands = int(numCoefficients)
    maxMel = int(freqToMel(maxHz))
    minMel = int(freqToMel(minHz))

    # Create a matrix for triangular filters, one row per filter
    filterMatrix = numpy.zeros((numBands, blockSize))

    melRange = numpy.array(xrange(numBands + 2))

    melCenterFilters = melRange * (maxMel - minMel) / (numBands + 1) + minMel

    # each array index represent the center of each triangular filter
    aux = numpy.log(1 + 1000.0 / 700.0) / 1000.0
    aux = (numpy.exp(melCenterFilters * aux) - 1) / 22050
    aux = 0.5 + 700 * blockSize * aux
    aux = numpy.floor(aux)  # Arredonda pra baixo
    centerIndex = numpy.array(aux, int)  # Get int values

    for i in xrange(numBands):
        start, centre, end = centerIndex[i:i + 3]
        k1 = numpy.float32(centre - start)
        k2 = numpy.float32(end - centre)
        up = (numpy.array(xrange(start, centre)) - start) / k1
        down = (end - numpy.array(xrange(centre, end))) / k2

        filterMatrix[i][start:centre] = up
        filterMatrix[i][centre:end] = down

    return filterMatrix.transpose()

def freqToMel(freq):
    return 1127.01048 * math.log(1 + freq / 700.0)

def melToFreq(mel):
    return 700 * (math.exp(mel / 1127.01048) - 1)

Hi, Do you mean for "file.wav" to be a frame (10ms to 30ms)? If not, you need to split signal into small frames and then apply the operations you did to each frame. For each frame, you should get out 13 coefficients.

... I was confused with that too. I assumed he was talking about the size of the window. It's Where we grab the values and then compute the FFT on it. Please confirm

but what happens once i have the coefficients? what do it do with them? im assuming i get the coefficients of sound one and then the coefficients of sound 2... then what

Sorry! I extracted it from my research code, then i forgot do made it clear. Consider "file.wav" as a sound frame with 10ms to 30ms! I think just have the coefficients isn't enough. You need to pass MFCC for an algorithm to classify it. I'm using a back-propagation neural network here to classify percussive sounds. An interesting project that uses MFCC to classify drum and other percursive sounds is william brandt's timbreID

there's a bug in the melToFreq() function, the -1 should be outside the inner parentheses

logging - HOW to get MFCC from an FFT on a signal? - Stack Overflow

logging signal-processing fft
Rectangle 27 3

You made some assumptions which might not be correct. Regular android phones have no Line Ins.They are not designed to be professional audio systems.

When you plug your headset, android automatically recognises your external MIC and you dont need to set it in your code.Just leave it in DEFAULT.

The problem is, you will need an special and compatible connector for your MIC. As you might notice the headset connector for your mobile is different from an streo Jack.So you will need an adapter or solder your own compatible Jack.If you connect your MIC with two parts, android will assume that its a headphone and not a MIC!

Here is the link to article: How do I use an external microphone with my Galaxy Nexus?

(Android) Get audio signal from the audio line-in instead of phone mic...

android audio microphone recording
Rectangle 27 2

When you inspect your signal handle, you won't find any property changing, when you modify the signal position. So I would assume there is no simple way to do what you want. Maybe you can work with the underlying java objects, but it will complicated. (... and I can't help on that)

I assume you create your whole model programmatically, don't you? So you specify the exact position of your blocks and probably use the add_line command to draw the connections. Why not considering labeling the signals using annotations? You name your signal as before, but you don't make the label visible. Instead of this you use a programmatically generated annotation, like in the example of the documentation linked above:

new_system('test')
open_system('test')
add_block('built-in/Gain', 'test/Gain', 'Position', ...
[260, 125, 290, 155])
add_block('built-in/Note','test/programmatically created', ...
'Position', [550 0 0 180])

The only downside of doing this is if you then move the block and/or signal line, the annotation will not move with it. But I agree, I don't think there is a way to specify where the signal name appears on the signal line.

But if he "moves" the line by mouse, then I don't see the point of the question, because he could just move the label as well. But if everything is programmed, he could just "bundle" every generation of a signal with the generation of a new annotation, with dependent position. Interactivity is not the objective I guess.

True... I just thought it would be nice if when moving the line by mouse, the label would follow.

How to get location of signal name on signal line (MATLAB/Simulink) - ...

matlab simulink
Rectangle 27 3

Alternatively, you can find the signal dimensions and signal widths of each block they originate from, using:

get_param(<block_path>,'CompiledPortDimensions')
get_param(<block_path>,'CompiledPortWidths')

Replacing <block_path> with the appropriate block path for each block of interest. The model must be compiled before you can run these commands, but since you indicate doing this after running the model, that shouldn't be a problem.

matlab - How can I get signal dimensions in Simulink model - Stack Ove...

matlab simulink
Rectangle 27 3

As EOF mentioned in the comments, the much better way to do this, that doesn't require formally broken casts, and a bonus is correctly documented, is to install your signal handler using sigaction and the SA_SIGINFO flag, and then in the si_code field of the second parameter (type siginfo_t) you can determine which floating-point error occurred:

The following values can be placed in si_code for a SIGFPE signal:

FPE_INTDIV
FPE_INTOVF
FPE_FLTDIV
FPE_FLTOVF
FPE_FLTUND
FPE_FLTRES
FPE_FLTINV

FPE_FLTSUB Subscript out of range.

The same list is also readily available on the FreeBSD siginfo man page.

What is the (2) in the function name?

(2)

c - How to get further information on SIGFPE signal? - Stack Overflow

c unix signals posix bsd
Rectangle 27 2

If you have a set of line handles from your find_system command you can use the following command to get the block connected to the signal.

hblkSrc = get_param(h(k),'SrcBlockHandle');
get_param(hblkSrc,'CompiledPortDimensions')

matlab - How can I get signal dimensions in Simulink model - Stack Ove...

matlab simulink
Rectangle 27 2

You can solve it the following way.

  • Enable signal logging for the desired signals (Properties). For example set the name to custom and signalone.
Limit data points to last
  • Go to SImulink preferences and enable signal logging, default output name is logsout
  • after simulation you'll get a dataset logsout in your workspace
% returns data, if data limit is set to 1 it's a coloumn 
% vector with just the last value
data = logsout.get('signalone').Values.Data

you can now just use the size of this vector and you know the dimension of the signal

[~,dim]=size(data)

or in one line:

[~,dim]=size(logsout.get('signalone').Values.Data)

If you have a a lot of signals and you want to evaluate them at once, give your signals convenient output-names and use a loop for iterating through a string vector with all your signal names.

As you say you want the dimensions of "all" (are you sure?) signals I think it is more convenient to just check "Enable signal logging" in each signal property and do all further definitions in the Simulink preferences where you have a list to manage all signals.

matlab - How can I get signal dimensions in Simulink model - Stack Ove...

matlab simulink
Rectangle 27 2

I don't think the algorithm consists of multiplying the sequence by a constant, but by the complex signal exp(n*i*2pi*freq/samplerate); 0<=n<=length, and getting the average magnitude (or power of the signal).

As the complex output is R*exp(i theta), R gives the power at the given frequency and theta gives the phase. (theta == atan2 ( imag, real))

Phase relative to what though ? It would be completely arbitrary and meaningless in this context.

@PaulR phase does not have to be in relation to something, if you perform a bpsk , the phase is related to the previous phase . wish you could understand that .

The first measurement gives you the reference phase...

signal processing - Goertzel algorithm to get the phase? - Stack Overf...

algorithm signal-processing
Rectangle 27 2

The number of samples you need to feed a Goertzel filter will be inversely proportional to your desired or required filter bandwidth. A Goertzel provides a Sinc shaped bandpass filter, with the main lobe width proportional to 2*Fs/N.

If you use a complex Goertzel, the resulting phase will be relative to some point in the filter's data window. You may thus have to calculate an offset to get phase relative to some other reference point in time.

thanks, so if i give it 50 samples i get a nice bw of 1700hz , the problem is, that 50 is a lot, and i can miss a lot, unless i am running on ALL of my samples and not every 50 samples- which than makes Goerzel less better than FFT, is that right ?

signal processing - Goertzel algorithm to get the phase? - Stack Overf...

algorithm signal-processing
Rectangle 27 1

As thewaywewalk mentioned, there's no programmatic way of doing what you want (at least none that is documented). You can programmatically name a signal by setting the name parameter of the port or line that represents the signal:

p = get_param(gcb, 'PortHandles')
l = get_param(p.Outport, 'Line')
set_param(l, 'Name', 's9')

But according to the documentation, you can only move the signal label interactively with the mouse:

Labels can appear above or below horizontal lines or line segments, and left or right of vertical lines or line segments. Labels can appear at either end, at the center, or in any combination of these locations.

To move a signal label, drag the label to a new location on the line. When you release the mouse button, the label fixes its position near the line. You cannot drag a label away from its signal, but only to a different location adjacent to the signal.

How to get location of signal name on signal line (MATLAB/Simulink) - ...

matlab simulink
Rectangle 27 1

The information that glibc refers to is a historic mechanism, and is not portable. On FreeBSD, the sigvec(2) manual page includes a notation that it is only supported on the VAX-11 architecture:

On the VAX-11 The handler routine can be declared:

void  handler(sig, code, scp)
int sig, code;
struct sigcontext *scp;

Here sig is the signal number, into which the hardware faults and traps are mapped as defined below. The code argument is either a constant as given below or, for compatibility mode faults, the code provided by the hardware (Compatibility mode faults are distinguished from the other SIGILL traps by having PSL_CM set in the psl). The scp argument is a pointer to the sigcontext structure (defined in <signal.h>), used to restore the context from before the signal.

The mapping list is not actually provided in this version of the manpage. It can be found in the 4.3BSD-Reno signal(3) manpage. It's worth noting that this text is 25 years old.

On modern systems, you should use the sigaction mechanism, which is much more well-defined and portable.

c - How to get further information on SIGFPE signal? - Stack Overflow

c unix signals posix bsd
Rectangle 27 1

wait()

WIFEXITED(wstatus) returns true if the child terminated normally, that is, by calling exit(3) or _exit(2), or by returning from main().

The child signal handler ends the process using exit(), so everything works a specified.

Remove the call to exit() from the signal handler to get the expected result.

The call to raise() inside the signal handler most likely leads to recursive calls, so remove is as well.

c - Inform parent process about child get signal after signal handler ...

c unix process fork ipc
Rectangle 27 1

Your callback method is running in thread. You cannot update Qt GUI objects from another thread. This is why you see errors and get segfaults.

Here are a bunch of other stack overflow questions which do something similar (send data from a thread into the qt main thread to avoid segfaults) or will be useful when delving into multithreaded pyqt applications:

python - Replotting graph based on ROS subscribed data - Stack Overflo...

python pyqt ros qwt
Rectangle 27 0

In the slot that gets called when the signal is emitted you can get the text with QString str = textEdit->toplainText();. Also you can store the previous version of the string and compare to get the character that was added and its position.

Regarding the cursor position you can us QTextCurosr class as in this example:

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTextEdit>
#include <QTextCursor>
#include <QVBoxLayout>
#include <QLabel>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = 0);

    ~Widget();

private slots:
    void onTextChanged();
    void onCursorPositionChanged();

private:
    QTextCursor m_cursor;
    QVBoxLayout m_layout;
    QTextEdit m_textEdit;
    QLabel m_label;
};

#endif // WIDGET_H
#include "widget.h"

#include <QString>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    connect(&m_textEdit, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
    connect(&m_textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));


    m_layout.addWidget(&m_textEdit);
    m_layout.addWidget(&m_label);

    setLayout(&m_layout);
}

Widget::~Widget()
{

}

void Widget::onTextChanged()
{
    // Code that executes on text change here
}

void Widget::onCursorPositionChanged()
{
    // Code that executes on cursor change here
    m_cursor = m_textEdit.textCursor();
    m_label.setText(QString("Position: %1").arg(m_cursor.positionInBlock()));
}
#include <QtGui/QApplication>
#include "widget.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec();
}

I'd expect "cursor" refer to the text cursor, which can also be read from the textEdit object.

didn't understand exactly what you wanted. updated the post.

c++ - Get QTextEdit changes when textChanged() signal is emited - Stac...

c++ qt networking notepad qtextedit
Rectangle 27 0

Have a look here (official Qt documentation for Qt's signal/slot mechanism regarding threads).

Each slot is called inside its thread, therefore I am pretty sure anything can happen. You should install a lock mechanism.

The lock is already implemented :) but i have discovered that with a slot that blocks forever, emitting a signal to this slot and calling QCoreApplication::sendPostedEvents() also blocks forever. Even if signal and slot are in two different threads (using auto/queued connection). Therefor i believe that all the slot calls from one thread are synchronized when it comes down to the actual event processing. But maybe the effect happened because of the slot living in the main app thread. Hoped someone already looked into relevant parts of qt source code and know for sure whats happening.

Are you sure that your QObject lives in different thread (it's not a QThread). Show us some code that creates your "different thread slots"

c++ - Can QT call two slots simultaneously, if they get called from th...

c++ multithreading qt qt4 signals-slots