Play sound in C, MacOS

How can my program play an audio signal? Is it also possible to reproduce sound with frequency and duration?

+4
source share
3 answers

This is for windows. For Mac check this post .

#include <iostream> #include <windows.h> // WinApi header using namespace std; int main() { Beep(523,500); // 523 hertz (C5) for 500 milliseconds Beep(587,500); Beep(659,500); Beep(698,500); Beep(784,500); cin.get(); // wait return 0; } 
+1
source

There NSBeep() in AppKit.

0
source
 #include <stdio.h> int main(void) { putchar('\a'); return 0; } 
0
source

Source: https://habr.com/ru/post/1313191/


All Articles