How to implement AudioUnit descended from MusicDeviceBase with 1 output and 2 inputs? (it generates silence in Digital Performer) - core-audio

I have a really weird issue here. I implemented an AU, using MusicDeviceBase. If the AU has 1 input bus and 1 output bus, it works everywhere. If it has 2 inputs (main and sidechain input), it works too, but not in Digital Performer - it seems working fine, but DP just interprets the output as silence. So it must be some AU buffering problem. I do this in the overriden Render method:
PullInput for all inputs and retrieve the buffers via GetBufferList
get output buffers via GetBufferList for the single output
then just render all the stuff from input to output...
The output buffers are definitely not silent, but DP shows nothing...
Any ideas?
Thanks in advance!

Ok, so the reason was, the "silent" tag. So this is the solution:
ioActionFlags &= ~kAudioUnitRenderAction_OutputIsSilence;

Related

53C94 SCSI IC as target - Cannot handle WRITE(10) command from Initiator

I am building a SD card/SCSI adapter using NCR 53CF94 IC and STM32.
All goes pretty well, even manged to make my device work to some degree, i.e. accepting all basic commands and even booting from it to DOS. BUT i have a problem, when asking initiator (PC) to write something to my device , all goes well i get the block address and the data. Then i write the data to SD card and finally responding with status=0 and message=0 to complete the write command, but the initiaor never increasing the secoor number to continue to write proccess and always tries to write the first one, then after few attempts it gives error on the PC (Error writing to drive...). I can't figure it out why the initiaor is not satisfied with the GOOD status and message. Do i need to send some specific data back to the initiator ? Linke CRC ? Or there is some specific command i need to issue for 53C94 ?
Banging my head for few days now.
Need your assistance please.
Thanks !
Artiom.
I figured it out. I was writing 512 byte blocks to a 256 byte array. I'm not sure how this is related to the issue, but after fixing the size everything started to work.

Arduino serial sometimes gives random values

I am using a MMA7361 accelerometer from sparkfun that is connected to my arduino uno and it is in turn connected to my pc.
I am simply reading the values from each axis(x,y,z) and sending them straight through the serial port to my pc with a series of Serial.print and Serial.write. From there I have set up a program to read and display the info with myPort.readString();
Now it works fine 80% of the time and it gives the right results and all, but sometimes I get some random value sent through the serial port and it messes up the receiving program making me unable to use the signal properly.
I am pretty sure its not the sensor itself sending the disturbing signal because I have tried to save 10 different readings and then sending an average to minimize the effect with no luck. The receiving pc still got the weird value spikes around 0-200 (from what I saw as output).
I tried with pulling out the cable that connects from the sensor to the analog in port and weirdly it gave out some random value instead of the expected 0, I'm not sure but for me it seems like that has something to do about my problem.
I have read about some kind of pull down resistor but that only works for buttons, right?
I just got my arduino and I'm trying to learn how to use sensors and what you can do with them and what can go wrong so I'd appreciate if someone could help me with this :)
Heres an example of the random value messing up the output:
252:236:218
251:202:215
2 <-- this is where it begins
59:231:245
28
4:144:142 <-- messing up the order of the values
251:19
2:187
246:235
:244
240:190:
238
250:202:2
32
248:243:224
245:227:240
251:228:244
253:223:241
If you want I got the code for sending and recieving too:
Serial.print(analogRead(xpin));
Serial.write(":");
Serial.print(analogRead(ypin));
Serial.write(":");
Serial.println(analogRead(zpin));
I'd really like the sending to be just one line of code but I haven't been able to join all numbers and strings to a one line string on the arduino.
Recieving:
if ( myPort.available() > 0) {
result = myPort.readString();
println(result);
}
Looking at your output, it seems that the values are all received, but somehow a CR and/or LF character is added to the output. And that comes from the println statement:
if ( myPort.available() > 0) {
result = myPort.readString();
println(result);
}
What happens is that the receiving end gets some characters (not necessarily all), it prints them, adding a linefeed character then exits the function.
Then it enters the if statement again and prints the available characters in the buffer. And so it goes.
If you wish to ensure a consistent output you have to either
1. build a packet of the data or
2. Count the received bytes and print them when all are received.
As to 1. it would be my preferred method, add a start- and end-character to the data. The receiving end will then know that all data between the start- and end-character is the data to be printed.
I seem to have fixed this by using readChar and checking if the current character inputted is the delimiter. It is a bit slower but it works.

adjusting the baud-rate of pic24

i have a device outputting an data with 19200 baud.
The pic has been configured with SPBRG=12 BRGH=0 start and stop bits have been taken into account.
Nevertheless the pic doesn't receive the correct data!
The data sent has been verified with hyper terminal and oscilloscope.
i can't find the error! Damn
any help?
Thx
Besides the electrical, on some versions of PIC24 (actually I use dsPIC33, but they are much the same) there is also peripheral pin select to deal with. I also set TRIS appropriately, but I think that is not necessary.

Audiorecorder, Choosing the input channels. Mac and RME

I am trying to simply record sound through an external sound card: RME Fireface 400.
This is the code I am using:
AO = audioplayer(mls_o,fs,16,5); % mls_o is the signal that is played.
AI = audiorecorder(fs,16,2,5); % 2 CHANNELS BUT HOW DO I ASSIGN THEM
play(AO);%playing
recordblocking(AI,1,2);%recording
y_rec=getaudiodata(AI);
delete(AI);% Deleting the objects
delete(AO);
I can only chose the number of channels, but not to address them.
Audiorecorder only supports 2 channels and Fireface have 8 input channels. I have to use the first two analog: ch5 and ch6. However, by default audio recorder only look 1st and 2nd one, which are mic inputs.
Otherwise do you know any other way of doing that?
I don't think you can do this with just the audiorecorder object. Check out the playrec library and pa-wavplay FileExchange submission, either of which should be capable of doing what you need. I believe Psychtoolbox also allows you to do this, but that might be overkill for your needs.

Is it possible to use midiOutLongMsg to play a chord? (Win32 API)

This guys says yes:
http://web.tiscalinet.it/giordy/midi-tech/lowmidi.htm
Same with a really old book from 1998 (Maximum MIDI).
MSDN doesn't mention it.
I'm not getting any sound.
I fill a char buffer with status|note|velocity|status|note|velocity...
Set lpData, dwBufferLength, and dwFlags of a MIDIHDR struct
call midiOutPrepareHeader (MMSYSERR_NOERROR)
call midiOutLongMsg (MMSYSERR_NOERROR)
Still no sound! Spamming midiOutShortMsg is working but will that work for slower machines? Did they change the functionality?
Thanks.
I'm an idiot! I figured it out: Microsoft GS Wavetable Synth does NOT support sending multiple short messages in midiOutLongMsg. The MIDI Mapper DOES!
midiOutShortMsg should be plenty fast, even on slow machines. MIDI interfaces themselves (hardware that is, but some software will limit themselves) run at 31,250 baud. This of course is ignoring any slow code you may have wrapped around where you call midiOutShortMsg.
Anyway, technically you should also be able to get away with one status byte, if the following notes use the same status byte. So, if you want to do note on/off (using velocity 0 for off) and those notes are on the same channel, you could do this:
status|note|velocity|note|velocity|note|velocity|note|velocity
This is called running status.

Resources