Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-30 Thread Emanuel Landeholm
>>> /* Update phase, rollover at 1.0 */ >>> data->phase[0] += (data->frequency[0] / SAMPLE_RATE); >>> if(data->phase[0] > 1.0f) data->phase[0] -= 2.0f; >>> data->phase[1] += (data->frequency[1] / SAMPLE_RATE); >>> if(data->phase[1] > 1.0f) data->phase[1] -= 2.0f; >> >> You haven't shown us the decl

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-29 Thread eugen
Hello, Indeed, that was the cause - at 48 kHz sampling rate the output spectrum is good. The sampling rate conversion is probably done inside ALSA -- when accessing device 0 it worked as expected. Thanks, Eugen Epure > Hi, > > Try using 48 kHz sampling rate instead of 44.1 kHz (or the other way

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-27 Thread eugen
The factor in the sine argument must be 2*M_PI, otherwise it generates half the frequency. Because of the sine periodicity, all this work: if(phase > 1.0) phase -= 1.0; // sine arg rolls over 2*PI->0 if(phase > 1.0) phase -= 2.0; // 2*PI->-2*PI if(phase > 0.5) phase -= 1.0; // PI->-PI First is pro

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-27 Thread Alan Wolfe
Might want to ask this one on the PA list (: On Wed, Apr 27, 2011 at 2:47 PM, wrote: > Hello, > > Today I tried compiling on Windows with MinGW & MSYS, and everything > works, the spectrum is clean at SR=44.1 kHz and even the LUT version is > acceptable. > > Probably on linux I was mixing differ

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-27 Thread eugen
Hello, Today I tried compiling on Windows with MinGW & MSYS, and everything works, the spectrum is clean at SR=44.1 kHz and even the LUT version is acceptable. Probably on linux I was mixing different versions of header and linked library. I also tried in linux copying directly input buffer to ou

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-27 Thread Wen X
that distortion. Xue -Original Message- From: music-dsp-boun...@music.columbia.edu [mailto:music-dsp-boun...@music.columbia.edu] On Behalf Of Ross Bencina Sent: 27 April 2011 06:39 To: A discussion list for music-related DSP Subject: Re: [music-dsp] Sinewave generation - strange spectrum eu

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-27 Thread robert bristow-johnson
On Apr 27, 2011, at 1:38 AM, Ross Bencina wrote: eu...@lavabit.com wrote: *out++ = data->amplitude[0] * sinf( (2.0f * M_PI) * data->phase[0] ); *out++ = data->amplitude[1] * sinf( (2.0f * M_PI) * data->phase[1] ); /* Update phase, rollover at 1.0 */ data->phase[0] += (data->frequency[0] / SAM

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Ross Bencina
eu...@lavabit.com wrote: *out++ = data->amplitude[0] * sinf( (2.0f * M_PI) * data->phase[0] ); *out++ = data->amplitude[1] * sinf( (2.0f * M_PI) * data->phase[1] ); /* Update phase, rollover at 1.0 */ data->phase[0] += (data->frequency[0] / SAMPLE_RATE); if(data->phase[0] > 1.0f) data->phase[0]

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Alan Wolfe
rule out everything except your algorithm ? >> >> Regards >> Rob >> >> -Original Message- >> From: Alan Wolfe >> Sent: Tuesday, April 26, 2011 9:14 PM >> To: A discussion list for music-related DSP >> Subject: Re: [music-dsp] Sinewave gene

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread eugen
ginal Message- > From: Alan Wolfe > Sent: Tuesday, April 26, 2011 9:14 PM > To: A discussion list for music-related DSP > Subject: Re: [music-dsp] Sinewave generation - strange spectrum > > just stabbing in the dark in case nobody else gives a more useful > response but...

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Gabor Pap
Hi, Try using 48 kHz sampling rate instead of 44.1 kHz (or the other way). AFAIK the HDA Intel is an integrated soundcard, it might have a low quality sample rate converter / interpolator. Regards, Gabor Pap On Tue, Apr 26, 2011 at 11:55 PM, wrote: > Thanks for the quick response. > > #1 Outp

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread eugen
Thanks for the quick response. #1 Output format is paFloat32; I also tried initially with paInt16 and a sine wavetable, and the result was almost identical. #2, #3 I've just tried using doubles, and replacing data->amplitude with 0.1, and the result is identical, data->amplitude[0],[1] was consta

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Rob Belcham
verything except your algorithm ? Regards Rob -Original Message- From: Alan Wolfe Sent: Tuesday, April 26, 2011 9:14 PM To: A discussion list for music-related DSP Subject: Re: [music-dsp] Sinewave generation - strange spectrum just stabbing in the dark in case nobody else gives a mo

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Alan Wolfe
oh also, it *might* matter what device you are using with port audio. for instance, when i use ASIO i seem to get a much louder, more raw signal than if i use, say, the directsound interface. i think the DS device must do some kind of dsp on it like maybe there's a compressor or something. To ru

Re: [music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread Alan Wolfe
just stabbing in the dark in case nobody else gives a more useful response but... #1 - what is the format of your output? If it's low in bitcount that could make the signal more dirty i believe (less resolution to make a more perfect sine wave) #2 - have you tried calculating via doubles? #3 -

[music-dsp] Sinewave generation - strange spectrum

2011-04-26 Thread eugen
Hello, I want to generate two different frequency sinewaves on LineOut - Left&Right. For audio IO I'm using Portaudio(Linux, PortAudio V19-devel (built Apr 17 2011 22:00:29)), and the callback code is: static int paCallback( const void* inBuff, void* outBuff,