I was so mushy that I wanted to have a national plane heal me. I have no regrets.

tired

I was tired ...

what will you do

I need healing. Healing is surely your hometown ... nothing else. Where is our hometown? It's in the PC98 series. Famicom Classic is also selling stupidly. (Although 66 or 88 people seem to be hit, Apple II people should use Virtual II to seek Disk II)

The distant hometown is there in the dam ...

I don't have the actual PC98 anymore ... But even if you don't have an actual machine, you can live with Pipo. Pipo is a beep sound after all, so if you generate it, you can think of your hometown ...

Create a hometown

It seems that pygame can generate sounds and make them sound, so if you googled appropriately, someone was doing. Thx! Hometown is near ...

Find out your hometown

The sound of my hometown seems to be 2000KHz for 100ms, and a little wait for 1000KHz for 100ms. Or rather, this depends on your hometown (maybe it depends on the clock). Yes, there are as many hometowns as there are machines ・ ・ ・

Create a hometown

words are not necessary. All I need is a code ... Oh, my hometown is near

pc98.py


from array import array
from time import sleep

import pygame
from pygame.mixer import Sound, get_init, pre_init

class Note(Sound):
    def __init__(self, frequency, volume=.1):
        self.frequency = frequency
        Sound.__init__(self, self.build_samples())
        self.set_volume(volume)

    def build_samples(self):
        period = int(round(get_init()[0] / self.frequency))
        samples = array("h", [0] * period)
        amplitude = 2 ** (abs(get_init()[1]) - 1) - 1
        for time in range(period):
            if time < period / 2:
                samples[time] = amplitude
            else:
                samples[time] = -amplitude
        return samples


if __name__ == "__main__":
    pre_init(44100, -16, 1, 1024)
    pygame.init()

    Note(2000).play(100)
    sleep(0.1)

    Note(1000).play(80)
    sleep(1)

Return to home

Install pygame. If it's different from your hometown, change the duration and sleep time after .play by yourself ... I was tired.

$ pip install pygame
$ python pc98.py

I'm back···!

Thanks to the train owners and crew for their hometown

next time

When I returned to my hometown and took a walk in the dusk for a while, I suddenly remembered the girl I admired. It's an old story. I used to go to the sea and space to play with her ... I miss her. I was walking thinking about that.

"Ah, ◯◯ -kun?" Suddenly I was called out, and with that nostalgic quivering voice, I exploded a drum.

Next time, the first love is the taste of BIO_100%. looking forward to

Recommended Posts

I was so mushy that I wanted to have a national plane heal me. I have no regrets.
A story that I was addicted to at np.where
A story that I was addicted to calling Lambda from AWS Lambda.
I started to work at different times, so I made a bot that tells me the time to leave
I have read 13 books that connect data science to business results, so I will write a book review.
[Python] I made a decorator that doesn't seem to have any use.
I was addicted to trying Cython with PyCharm, so make a note
A story that I was addicted to when I made SFTP communication with python
I set up TensowFlow and was addicted to it, so make a note
[Introduction to json] No, I was addicted to it. .. .. ♬
I uploaded a module to pypl that deletes Japanese stop words, so share it
It was a life I wanted to OCR on AWS Lambda to locate the characters.