sampling & recording streaming data from 1/8" audio input

I'd like to record sampling data from an instrument (guitar, keyboard, etc.) hooked into the audio input via a 1/4"-1/8" adapter into, say, a .txt or .dat file to be manipulated in ways undetermined at the present. Could I use my audio input as an istream object, writing to a file which another could read from simultaneously? This is my first time trying something like this, so I'd appreciate any help I could get.
Last edited on
1) Get yourself a library.
2) So you want to write binary data into a *.txt file?
3) And you'd like to write and read from a file stored on your hard drive at the same time? Don't you think that would be a bit lame? Apart from the fact it won't work. Such functionality is implemented by a buffer class.
1) Sorry, I know I'm a nûb.
2) I'm trying to create a magic function where I can set i=0 then be like sample[i] = guitarSignal.get(amplitude), i++. and then be like outputFile << sample[i] and write a space or endl that shit

Look basically what I'm trying to do here is create an array of one-channel amplitude samples from the audio input with a known sampling frequency.
Last edited on
Then, what's the big hold-up? You have a pretty concrete concept, now realize it. You could already be writing Guitar::get();.
Not really as concrete as you think, considering I don't know where to go from there. I don't know which functions exist that would return the amplitude of the input signal. I have pretty limited experience in OOP and in using classes and all, so... hold my hand, Magnus. I want to feel you. mmm.... that's nice. so baby,

would I create a class called, say, Instrument? For which any input signal could be assigned to an object of the type? And then would I define an operator to "sample" the signal? aka to return the amplitude of the signal as an int or whatever. If so, how would I write that operator? I could do the rest if that's how it would be done, but I'm unclear as to how to actually sample the signal.
Last edited on
Topic archived. No new replies allowed.