C code for tone generator in linux - c

I want to write a c code to generate tone using array output to DAC in ubuntu. (preferably alsa driver)
For example:
I need to be able to send voltage output to DAC like 1100000 etc. to be able to generate a tone. Is it possible?
P.S. I had a look at tones. Is it possible to do that using a c code rather than a bash command?

Something like pcspkr_pcm.c as a starting point perhaps. It is used by (bsvplay, qplay) also from within the hxtools suite.

Related

can I use simpy(Python simulation library) in C?

I was assigned project that make operation system scheduling program in C and show simulation result in university.
I want to use simpy so that find out how to use python in C.
but I'm not sure simpy work in C because it looks like python work in C, just low-level.
can I use simpy in C?

What does the Serial method do? [Arduino]

I'm translating a program about an RFM Hopper Transmission from Arduino to C, but I'm stuck with the method Serial, since I don't exactly know what it does.
It only appears in the following line, inside the main of the program.
Serial.begin(115200);
I've searched online through the documentation of Arduino and only understand that it's used for comunication between the Arduino board and the other devices.
If cannot use it in my C program though, what am I missing?
https://www.arduino.cc/reference/en/language/functions/communication/serial/
If I can explain anything with more detail from my project please feel free to ask.
Serial is an object, predefined in the Arduino environment, which is in C++ (not C )
To use it, you should call Serial.begin(<baud>); in the setup() function of the Arduino environment, then you can use any method of Serial or the underlying base class
Stream

Starting Blackfin (BF527)

I am very new in Blackfin processors and I suppose to write a tester program for Blackfin, BF527. This tester program should test the connection of the board and 2 peripheral RAMs.
So far I have downloaded and installed VisualDSP++ (90-day trial version).
Can anyone help me to know how can I write a simple program to write in port G and read From port H, including initialization (preferably in C).
I have looked for sample code on internet but unfortunately all the codes are very advance.
I went through the data sheet, but it was on assembly not C, still I couldn't find any solid sample program for my purpose.
Look in the VisualDSP installation folder (under Program Files). There is lots of sample C and C++ code in Analog Devices\VisualDSP 5.0\Blackfin\Examples
To program the hardware peripherals from C/C++ you need the header files which contain the pointer definitions for the memory-mapped registers. These will be found in Analog Devices\VisualDSP 5.0\Blackfin\include
In your code you can automatically select the correct include file for the project's processor using:
#include <blackfin.h>

Show OS tasks on Eclipse's outline

I've got some C code that runs on JenOS, a proprietary OS used on some NXP microcontrollers to manage ZigBee communication. This OS has a specific syntax to define tasks, that reads as follows:
OS_TASK(APP_ZPR_Light_Task)
{
...
}
Where OS_TASK is defined as:
#define OS_TASK(a) void os_v##a(void)
Obviously, these are not recognized as standard C functions, and thus are not displayed in the outline tab of Eclipse. Is there a way to include those in the outline without having to hack the source (I don't want to go there for obvious reasons)?
I don't know a way to change the pattern which Eclipse uses to recognize functions, so I suggest a workaround: Define the functions using your own pattern like:
void os_vAPP_ZPR_Light_Task(void) /*TASK*/
Now you can write a small utility which filters the file and replaces this line with the pattern which JenOS expects before you pass it to the original build tools.
Or maybe you can look at the Makefile; there should be a step where a tool analyzes the C sources for OS_TASK(...). Maybe you can hook in there to feed it the data in a different form.

Can I use C and ActionScript together?

I'm doing a project where I need to create some kind of GUI for the user as well as control some servo motors.
I'm thinking of using ActionScript for the GUI and C for to control the hardware. Is this even possible? How do I make ActionScipt talk to C and vice-versa?
Obviously the C part will be driving the motors and will send the data to the ActionScript GUI
to be displayed to the user.
Is the above possible? If yes, could someone kindly provide me some pointers?
Thank you very much!
Edit: How do I pass a variable (e.g. x = 5) from ActionScript to be printed in C? Or is this not possible?
"You could go via ASP to a DLL as TG suggested or you could probably call an ANSI C (command line) app and pass in variables (at least on a Windows PC)... that owuld be done using FSCommands. see this tutorial
http://www.actionscripts.org/tutoria...es/index.shtml"
Originally replied by
Jesse Stratford
ActionScript.org Cofounder
This is taken from here
I don`t know the specifics of programming servo motors but basically, if you want some C to AS3 interaction you could do one of the following:
Compile your C/C++ code using flascc.
Wrap your C code in a native extension (if you are targeting AIR).
As sberry suggested - use Sockets.

Resources