Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sound Feature #24

Open
BBBmau opened this issue Sep 5, 2023 · 3 comments
Open

Add Sound Feature #24

BBBmau opened this issue Sep 5, 2023 · 3 comments

Comments

@BBBmau
Copy link
Contributor

BBBmau commented Sep 5, 2023

Would be nice to implement some sounds into this, even if its as simple as just a start-up sound when booting.

@nxvvvv
Copy link

nxvvvv commented Oct 5, 2023

basically it will boot in an instant. so what you can do is just to edit the kernel, add the loading sound before it loads the logo and terminal.

@araujo88
Copy link
Owner

araujo88 commented Oct 6, 2023

I found this function, but was unable to reproduce any sound in virtual box nor in qemu:

void beep() {
    // Set frequency (~440 Hz)
    __asm__ __volatile__ (
        "movb $0xB6, %%al;"
        "outb %%al, $0x43;"
        "movw $0x4E9, %%ax;"
        "outb %%al, $0x42;"
        "movb %%ah, %%al;"
        "outb %%al, $0x42;"
        : /* No output */
        : /* No input */
        : "al", "ax" // Clobbered registers
    );

    // Enable speaker
    __asm__ __volatile__ (
        "inb $0x61, %%al;"
        "orb $3, %%al;"
        "outb %%al, $0x61;"
        : /* No output */
        : /* No input */
        : "al" // Clobbered register
    );

    // Delay (Note: You would normally use a timer for a precise delay)
    for (volatile int i = 0; i < 0xFFFFF; ++i);

    // Disable speaker
    __asm__ __volatile__ (
        "inb $0x61, %%al;"
        "andb $0xFC, %%al;"
        "outb %%al, $0x61;"
        : /* No output */
        : /* No input */
        : "al" // Clobbered register
    );
}

@nxvvvv
Copy link

nxvvvv commented Oct 8, 2023

What about pcspkr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants