2 turntables?

7 views
Skip to first unread message

leeM

unread,
Feb 9, 2012, 7:32:13 PM2/9/12
to ScratchML
I am in the process of "trying" to use the ofxsoundstream example so
we / I can have 2 turntables working. After getting to know more
about "deque" bitset operators and crashing my computer with their
well intended Apple message telling me to voluntarily turn my computer
off. All good to know but not sure if it's applicable. I came to the
decision to cut out all of the ...
audioin(float* input, int audioBuffersize, int nChannels){}
and stick it into….
audioInputListener(ofxAudioEventArgs &args){}

But I didn't know what to do with….
middleAudioBuffer.assign(input, input + audioBuffersize * nChannels);

So I imagined poorly or not, somehow this would help
for (int i = 0; i < args.bufferSize; i++){
left[i] = args.buffer[i*4];
right[i] = args.buffer[i*4+1];
left2[i] = args.buffer[i*4+2];
right2[i] = args.buffer[i*4+3];
}
middleAudioBuffer.assign(left, right + args.bufferSize * 2);

and I replaced
xwax.update(input);
for
xwax.update(args.buffer);

I get something. The record spends 4 times to 1 time to the virtual
record spent.
I'm using “M-Audio Conectiv” as the IO

I don't know if this is the right direction but maybe I've gone far
enough to get some good suggestions.

lee

Kyle McDonald

unread,
Feb 9, 2012, 7:49:22 PM2/9/12
to scra...@googlegroups.com
the line:

middleAudioBuffer.assign(input, input + audioBuffersize * nChannels);

just means:

for(int i = 0; i < audioBuffersize * nChannels; i++) {
middleAudioBuffer[i] = input[i];
}

you'll want something more like:

vector<float> inputLeft, inputRight;
inputLeft.resize(audioBuffersize);
inputRight.resize(audioBuffersize);
// nChannels = 4
for(int i = 0; i < audioBuffersize * nChannels; i += nChannels) {
inputLeft[i + 0] = input[i + 0];
inputLeft[i + 1] = input[i + 1];
inputRight[i + 0] = input[i + 2];
inputRight[i + 1] = input[i + 3];
}
xwaxLeft.update(&inputLeft[0]);
xwaxRight.update(&inputRight[0]);

hope that makes some sense.

leeM

unread,
Feb 18, 2012, 9:42:17 PM2/18/12
to ScratchML
So I've been able to apply Kyle's suggestions. One had been in a
separate e-mail which had been to substitute the previous code to the
for loop below.

for(int i = 0; i < args.bufferSize; i++) {
       int j = i * nChannels; // nChannels = 4
       int k = i * 2; // 2 for stereo
       inputLeft[k + 0] =  args.buffer[j + 0];
       inputLeft[k + 1] =  args.buffer[j + 1];
       inputRight[k + 0] = args.buffer[j + 2];
       inputRight[k + 1] = args.buffer[j + 3];
}

Here is a link
https://vimeo.com/37037336

thanks Kyle for the help
lee

leeM

unread,
Feb 24, 2012, 11:50:54 AM2/24/12
to ScratchML
new mov
I had tried to raise up the volume of the signal and it wasn't doing
anything to improve the response. So a little more work there. I did
do a nofill before the draw this time :)
I really need to put my face playback on I keep slamming my fingers on
my right side into the screw...

https://vimeo.com/37353636

My turntable game is close to a release but I would like to do a
version where this is incorporated. It had been a plan all along to
be able to send each other XML / !SML! files to scratching / teaching
against… In the digital dojo.

lee

On Feb 18, 9:42 pm, leeM <tesujicam...@gmail.com> wrote:
> So I've been able to apply Kyle's suggestions. One had been in a
> separate e-mail which had been to substitute the previous code to the
> for loop below.
>
> for(int i = 0; i < args.bufferSize; i++) {
>        int j = i * nChannels; // nChannels = 4
>        int k = i * 2; // 2 for stereo
>        inputLeft[k + 0] =  args.buffer[j + 0];
>        inputLeft[k + 1] =  args.buffer[j + 1];
>        inputRight[k + 0] = args.buffer[j + 2];
>        inputRight[k + 1] = args.buffer[j + 3];
>
> }
>
> Here is a linkhttps://vimeo.com/37037336

Kyle McDonald

unread,
Feb 24, 2012, 12:08:39 PM2/24/12
to scra...@googlegroups.com
so badass!

On Friday, February 24, 2012 at 11:50 AM, leeM wrote:

> new mov
> I had tried to raise up the volume of the signal and it wasn't doing
> anything to improve the response. So a little more work there. I did
> do a nofill before the draw this time :)
> I really need to put my face playback on I keep slamming my fingers on
> my right side into the screw...
>
> https://vimeo.com/37353636
>
> My turntable game is close to a release but I would like to do a
> version where this is incorporated. It had been a plan all along to
> be able to send each other XML / !SML! files to scratching / teaching
> against… In the digital dojo.
>
> lee
>

> On Feb 18, 9:42 pm, leeM <tesujicam...@gmail.com (http://gmail.com)> wrote:
> > So I've been able to apply Kyle's suggestions. One had been in a
> > separate e-mail which had been to substitute the previous code to the
> > for loop below.
> >
> > for(int i = 0; i < args.bufferSize; i++) {
> > int j = i * nChannels; // nChannels = 4
> > int k = i * 2; // 2 for stereo
> > inputLeft[k + 0] = args.buffer[j + 0];
> > inputLeft[k + 1] = args.buffer[j + 1];
> > inputRight[k + 0] = args.buffer[j + 2];
> > inputRight[k + 1] = args.buffer[j + 3];
> >
> > }
> >

> > Here is a linkhttps://vimeo.com/37037336 (http://vimeo.com/37037336)

Jamie Wilkinson

unread,
Mar 2, 2012, 1:46:07 PM3/2/12
to scra...@googlegroups.com
yeah this is awesome. Lee do you have your code online anywhere yet? Love to do something like make the crossfader dim the inactive channel

leeM

unread,
Mar 2, 2012, 4:32:52 PM3/2/12
to ScratchML
Tomorrow I will put it online either by me figuring out why I haven't
pulled off ignoring the right files on git. Which I should do…
But if time becomes crunched I will make sure to do it through on
diamondsandcode.com somewhere.
I'll post here at success. I will give some explanation because
sometimes I have to recompile to get the audio from all channels
separated And other "anomalies" I just…
lee
> >>> Here is a linkhttps://vimeo.com/37037336(http://vimeo.com/37037336)

leeM

unread,
Mar 11, 2012, 1:49:12 PM3/11/12
to ScratchML
So it took a little bit longer than I thought and I left out the open
sound control for the 1 turntable that was hooked up to osc. I will
comment out at lines 158-179.
There is a class called deck and thanks to Kyle the Sage the audio is
generalized using ofxSoundStream add-on. If you go into the XML and
select a different amount of decks ie. <decks>4</decks> and as long as
you have changed your interface tag ie. <interface>Native Instruments:
Audio 8 DJ</interface> you will get that amount. The screen does not
resize itself so change your main.h. :)
I forked.
https://github.com/leeMeredith/ofxXwax
you need ofxSoundStream
https://github.com/jocabola/ofxSoundStream
lee
Reply all
Reply to author
Forward
0 new messages