This is basically what the core of the program is:
ioctl(fd, KIOCSOUND, static_cast<int>(CLOCK_RATE / frequency)); std::this_thread::sleep_for(std::chrono::milliseconds(duration)); ioctl(fd, KIOCSOUND, 0);Where
fd
is the file descriptor of the audio device,CLOCK_RATE
is the clock rate of the PC speaker,frequency
is the frequency of the sound, andduration
is the duration of the sound.The
KIOCSOUND
constant is set inlinux/kd.h
.
./run.sh
- For SoundCloud importing, you need an OAuth token from SoundCloud. You can get
one here. Set the
SOUNDCLOUD_API_KEY
environment variable to that OAuth token. - A workaround is to play a track on SoundCloud in your browser, then open developer tools and copy the value of
the
oauth_token
cookie. This is your OAuth token as well.