Search Results

Search found 132 results on 6 pages for 'dsp'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Downsampling and applying a lowpass filter to digital audio

    - by twk
    I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accurately anymore, so I assume I want to cut everything above that out too. Any ideas? Thanks. Update: There is some code on this page that converts from 48KHz to 8KHz using a simple algorithm and a coefficient array that looks like { 1, 4, 12, 12, 4, 1 }. I think that is what I need, but I need it for a factor of 4x rather than 6x. Any idea how those constants are calculated? Also, I end up converting the 16 byte samples to floats anyway, so I can do the downsampling with floats rather than shorts, if that helps the quality at all.

    Read the article

  • Autocorrelation returns random results with mic input (using a high pass filter)

    - by Niall
    Hello, Sorry to ask a similar question to the one i asked before (FFT Problem (Returns random results)), but i've looked up pitch detection and autocorrelation and have found some code for pitch detection using autocorrelation. Im trying to do pitch detection of a users singing. Problem is, it keeps returning random results. I've got some code from http://code.google.com/p/yaalp/ which i've converted to C++ and modified (below). My sample rate is 2048, and data size is 1024. I'm detecting pitch of both a sine wave and mic input. The frequency of the sine wave is 726.0, and its detecting it to be 722.950820 (which im ok with), but its detecting the pitch of the mic as a random number from around 100 to around 1050. I'm now using a High pass filter to remove the DC offset, but it's not working. Am i doing it right, and if so, what else can i do to fix it? Any help would be greatly appreciated! double* doHighPassFilter(short *buffer) { // Do FFT: int bufferLength = 1024; float *real = malloc(bufferLength*sizeof(float)); float *real2 = malloc(bufferLength*sizeof(float)); for(int x=0;x<bufferLength;x++) { real[x] = buffer[x]; } fft(real, bufferLength); for(int x=0;x<bufferLength;x+=2) { real2[x] = real[x]; } for (int i=0; i < 30; i++) //Set freqs lower than 30hz to zero to attenuate the low frequencies real2[i] = 0; // Do inverse FFT: inversefft(real2,bufferLength); double* real3 = (double*)real2; return real3; } double DetectPitch(short* data) { int sampleRate = 2048; //Create sine wave double *buffer = malloc(1024*sizeof(short)); double amplitude = 0.25 * 32768; //0.25 * max length of short double frequency = 726.0; for (int n = 0; n < 1024; n++) { buffer[n] = (short)(amplitude * sin((2 * 3.14159265 * n * frequency) / sampleRate)); } doHighPassFilter(data); printf("Pitch from sine wave: %f\n",detectPitchCalculation(buffer, 50.0, 1000.0, 1, 1)); printf("Pitch from mic: %f\n",detectPitchCalculation(data, 50.0, 1000.0, 1, 1)); return 0; } // These work by shifting the signal until it seems to correlate with itself. // In other words if the signal looks very similar to (signal shifted 200 data) than the fundamental period is probably 200 data // Note that the algorithm only works well when there's only one prominent fundamental. // This could be optimized by looking at the rate of change to determine a maximum without testing all periods. double detectPitchCalculation(double* data, double minHz, double maxHz, int nCandidates, int nResolution) { //-------------------------1-------------------------// // note that higher frequency means lower period int nLowPeriodInSamples = hzToPeriodInSamples(maxHz, 2048); int nHiPeriodInSamples = hzToPeriodInSamples(minHz, 2048); if (nHiPeriodInSamples <= nLowPeriodInSamples) printf("Bad range for pitch detection."); if (1024 < nHiPeriodInSamples) printf("Not enough data."); double *results = new double[nHiPeriodInSamples - nLowPeriodInSamples]; //-------------------------2-------------------------// for (int period = nLowPeriodInSamples; period < nHiPeriodInSamples; period += nResolution) { double sum = 0; // for each sample, find correlation. (If they are far apart, small) for (int i = 0; i < 1024 - period; i++) sum += data[i] * data[i + period]; double mean = sum / 1024.0; results[period - nLowPeriodInSamples] = mean; } //-------------------------3-------------------------// // find the best indices int *bestIndices = findBestCandidates(nCandidates, results, nHiPeriodInSamples - nLowPeriodInSamples - 1); //note findBestCandidates modifies parameter // convert back to Hz double *res = new double[nCandidates]; for (int i=0; i < nCandidates;i++) res[i] = periodInSamplesToHz(bestIndices[i]+nLowPeriodInSamples, 2048); double pitch2 = res[0]; free(res); free(results); return pitch2; } /// Finds n "best" values from an array. Returns the indices of the best parts. /// (One way to do this would be to sort the array, but that could take too long. /// Warning: Changes the contents of the array!!! Do not use result array afterwards. int* findBestCandidates(int n, double* inputs,int length) { //int length = inputs.Length; if (length < n) printf("Length of inputs is not long enough."); int *res = new int[n]; double minValue = 0; for (int c = 0; c < n; c++) { // find the highest. double fBestValue = minValue; int nBestIndex = -1; for (int i = 0; i < length; i++) { if (inputs[i] > fBestValue) { nBestIndex = i; fBestValue = inputs[i]; } } // record this highest value res[c] = nBestIndex; // now blank out that index. if(nBestIndex!=-1) inputs[nBestIndex] = minValue; } return res; } int hzToPeriodInSamples(double hz, int sampleRate) { return (int)(1 / (hz / (double)sampleRate)); } double periodInSamplesToHz(int period, int sampleRate) { return 1 / (period / (double)sampleRate); } Thanks, Niall. Edit: Changed the code to implement a high pass filter with a cutoff of 30hz (from What Are High-Pass and Low-Pass Filters?, can anyone tell me how to convert the low-pass filter using convolution to a high-pass one?) but it's still returning random results. Plugging it into a VST host and using VST plugins to compare spectrums isn't an option to me unfortunately.

    Read the article

  • Matlab: Analysis of signal

    - by Mateusz
    Hi, I have a problem with this task: For free route perform frequency analysis and give parametrs of each signal component: time of beginning and ending of each component beginning and ending frequency amplitude (in time domain) in the beginning and end of each signal's component level of noise in dB Assume, that, the parametrs of each component like amplitude, frequency is changing lineary in time. Frequency of sampling is 1000Hz For example I have signal like this: Nx=64; fs=1000; t=1/fs*(0:Nx-1); %========================== A1=1; A2=4; f1=500; f2=1000; x1=A1*cos(2*pi*f1*t); x2=A2*sin(2*pi*f2*t); %========================== x=x1+x2;

    Read the article

  • Normalize amplitude and phase with c#

    - by Lehto
    Hey I'm in the situation where i need to do some math related stuff in c# and for that i need some external libarys. The tool i look for should do the following actions: Process sound(wave/mp3): Normalize the amplitude Normalize the phase Any idea which way to go? And is there a big difference if a should to it on mp3 instead of wav Michael.

    Read the article

  • .NET Library to Identify Pitches

    - by Antoni
    I'd like to write a simple program(preferably in C#) to which I sing a pitch using a mic and the program identifies to which musical note that pitch corresponds. Thank you very much for your prompt responses. I clarify: I'd like a (preferably .NET) library that would identify the notes I sing. I'd like that such a library: Identifies a note when I sing(a note from the chromatic scale). Tells me how much I'm off from the closest note. I intend to use such a library to sing one note a time.

    Read the article

  • Creating a music catalog and extracting first 30 seconds as soon as the first words are sung

    - by Rad
    I already read a question: Separation of singing voice from music. I don’t need this complex audio processing. I only need some detection mechanism that would detect that there is some voice/vocal playing while the music is playing (or not playing) I need to extract first 30 seconds when a vocalist starts singing along with full band music. See question 2 below. I want to create a music catalog using ASP.NET MVC 2 and Silverlight clients and C#.NET 4.0 programming language that would be front store. On the backend I would also like to create a desktop WPF/Windows application to create the music catalog from already existing music files, most of which have metadata in them ID3v1, ID3v2.3, ID3v2.4, iTunes MP4, WMA, Vorbis Comments and APE Tags etc. I would possibly like to create a web service that would allow catalog contributors to upload a zipped album and trigger metadata extraction of music data and extraction of music segments as described below. I would be happy if I achieve no. 1 below. Let's say I have 1000ths of songs in mp3 (or other formats) grouped in subfolders using some classification (Genre, Artists, Albums, Composers or other groupings). I want to create tables in DB that would organize songs so they can be searched based on different criteria (year, length, above classification or by song title, description etc) like what iTune store allows to their customers. I want to extract metadata from various formats (I will try to get songs in mp3 format, but there may be other popular formats) and allow music Catalog manager person to add missing data from either desktop or web applications. He or other contributors can upload zipped music via an HTML or Silverlight upload or WPF. Can anybody suggest open source libraries, articles, code snippets that can do that in an automatic way using .NET and possibly SQL Server DB? My main questions are these. This is an audio processing challenge. I want to extract 2 segments of music (questions 1 and 2): 1. How to extract a music segment: 1-2 seconds before a vocal starts singing and up to 30 seconds from that point in time and 2. Much more challenging is to find repeating segments (One would usually find or recognize the names of the songs and songs are usually known by these refrains. How would I go about creating a list of songs that go great together like what Genius from iTune does? Is there any characteristics of music that can be used to match songs? The goal is for people quickly scan and recognize songs i.e. associate melody, words with a title/album so they can make intelligent decisions like buying a song, create similar mood songs.

    Read the article

  • Recognizing individual voices

    - by raheel
    I plan to write a conversation analysis software, which will recognize the individual speakers, their pitch and intensity. Pitch and intensity are somewhat straightforward (pitch via autocorrelation). How would I go about recognizing individual speakers? For starters I can assume that only one person speaks at a time.

    Read the article

  • TI-99 speech effect?

    - by kotlinski
    Hi, I want to make a program that takes recorded speech and transforms it so it sounds like it's coming from a Texas TI-99. Do you have any good ideas and resources for how to go about that?

    Read the article

  • Convolving two signals

    - by John Elway
    Calculate the convolution of the following signals (your answer will be in the form of an equation): h[n] = delta[n-1] + delta[n+1], x[n] = delta[n-a] + delta[n+b] I'm lost as to what I do with h and x. Do I simply multiply them? h[n]*x[n]? I programmed convolution with several types of blurs and edge detectors, but I don't see how to translate that knowledge to this problem. please help!

    Read the article

  • Real-time spectrum analyzer with API

    - by bobobobo
    I'm looking for a C or C++ API that will give me real-time spectrum analysis of a waveform on Windows. I'm not entirely sure how large a sample window it should need to determine frequency content, but the smaller the better. For example, if it can work with a 0.5 second long sample and determine frequency content to the Hz, that would be wicked-awesome.

    Read the article

  • Linux, C++ audio capturing (just microphone) library

    - by TheOm3ga
    I'm developing a musical game, it's like a singstar but instead of singing, you have to play the recorder. It's called oFlute, and it's still in early development stage. In the game, I capture the microphone input, then run a simple FFT analysis and compare the results to typical recorder's frequencies, thus getting the played note. At the beginning, the audio library I was using was RtAudio, but I don't remember why I switched to PortAudio, which is what I'm currently using. The problem is that, from time to time, either it crashes randomly or stops capturing, like if there were no sound coming from the microphone. My question is, what's the best option to capture microphone input on Linux? I just need to open, read, and close a flow of bytes from the microphone. I've been reading this guide, and (un)surprisingly it says: I don't think that PortAudio is very good API for Unix-like operating systems. So, what do you recommend me?

    Read the article

  • "Winamp style" spectrum analyzer

    - by cvb
    I have a program that plots the spectrum analysis (Amp/Freq) of a signal, which is preety much the DFT converted to polar. However, this is not exactly the sort of graph that, say, winamp (right at the top-left corner), or effectively any other audio software plots. I am not really sure what is this sort of graph called (if it has a distinct name at all), so I am not sure what to look for. I am preety positive about the frequency axis being base two exponential, the amplitude axis puzzles me though. Any pointers?

    Read the article

  • Determining the best audio quality.

    - by The Rook
    How can you determine the best audio quality in a list of audio files, with out looking at the audio file's header. What if all of the files came from differnt encoding types and they where all transcoded to the same format and bit rate.

    Read the article

  • Real-time equalizer for all audio on computer

    - by greye
    Is it possible to capture all the sound from a computer and have it pass through a equalizer before reaching the speakers? How can you program a band pass filter on it? EDIT: I'm trying to get this on Windows (with Python? heh) but if there is a generic, cross-platform approach that would be great.

    Read the article

  • Code Composer 4 (Eclipse based)- makefiles

    - by michael
    How do I prevent Code Composer 4 (which is based on Eclipse) from generating its own makefile and use the one I provide instead? Background: I am starting a FreeRTOS project on a MSP430F5436 using Code Composer 4 and have a demo app with a supplied make file) Thanks!

    Read the article

  • How can I apply a DSP to my microphone in windows?

    - by user16315
    I'd like to be able to run my microphone through arbitrary DSP filters--Mostly for compression and amplification, but also noise cancelation would be nice. I'd then like to take that output and put it back in a virtual audio device that I could use as input for skype, mumble, teamspeak, or any other VOIP program. With a program like Virtual Audio cable, I can do the 'fake devices' part but as far as I know it does not allow any kind of filtering inline. Does a program like this exist? Or some combination of programs that can be combined to accomplish this?

    Read the article

  • How to play sound in Python WITHOUT interrupting music/other sounds from playing

    - by Morlock
    I'm working on a timer in python which sounds a chime when the waiting time is over. I use the following code: from wave import open as wave_open from ossaudiodev import open as oss_open def _play_chime(): """ Play a sound file once. """ sound_file = wave_open('chime.wav','rb') (nc,sw,fr,nf,comptype, compname) = sound_file.getparams( ) dsp = oss_open('/dev/dsp','w') try: from ossaudiodev import AFMT_S16_NE except ImportError: if byteorder == "little": AFMT_S16_NE = ossaudiodev.AFMT_S16_LE else: AFMT_S16_NE = ossaudiodev.AFMT_S16_BE dsp.setparameters(AFMT_S16_NE, nc, fr) data = sound_file.readframes(nf) sound_file.close() dsp.write(data) dsp.close() It works pretty good, unless any other device is already outputing sound. How could I do basically the same (under linux) without having the prerequisite that no sound is being played? If you think the process would require an API to ensure software mixing, please suggest a method :) Thx for the support

    Read the article

  • What is blocking incoming packets to port 67?

    - by Peter Robertson
    I have a DSP connected to a Windows 7 laptop by Ethernet. The laptop has all firewalls disabled (I've even tried stopping the Windows firewall service and DHCP). The DSP is sending well-formed BOOTP broadcast packets every 3 seconds to port 67. Wireshark running on the laptop sees these BOOTP packets coming in. I have a program running on the laptop with a socket successfully bound to port 67. I can see this using CurrPorts.exe. Nothing else is shown as accessing port 67. The program never sees any packets coming in. If I run a program in the DSP that sends ordinary UDP packets to port 67, Wireshark sees them coming in and reports that they are corrupt BOOTP packets, but now, my program gets them. Any idea what's going on here?

    Read the article

  • Condensing/abstracting the path shown on each line in PowerShell

    - by kRON
    I've started using virtualenv for my Python projects. Since the working directory for my projects is now deeply nested, the path has started to take up half of my screen! Is it possible to somehow have PowerShell condense the path to the current working directory, from something like C:\Users\kRON\Desktop\Current work\Python\dsp\src to C:\Users\kRON\Deskto~1\Curren~2\Python\dsp\src or, better yet, to match C:\Users\kRON\Desktop\Current work\Python\and just replace it with ~python\?

    Read the article

  • Stream sound card output to icecast2 via darkice

    - by Alberto Burgos
    I want to stream to icecast server via darkice, the default .cfg comes with /dev/dsp, witch is OSS, but there is no /dev/dsp in Ubuntu 12.10, so I tried hw:0,0, but it's just the microphone, and I would like to stream all of the sound-card output. Any ideas? cat /proc/asound/cards 0 [SB ]: HDA-Intel - HDA ATI SB HDA ATI SB at 0xf8700000 irq 16 cat /proc/asound/devices 1: : sequencer 2: [ 0- 0]: digital audio playback 3: [ 0- 0]: digital audio capture 4: [ 0- 0]: hardware dependent 5: [ 0] : control 33: : timer I tried following this post: How can I stream my soundcard output?

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >