Skip to content

Instantly share code, notes, and snippets.

[tool.pyright]
typeCheckingMode = "standard"
[tool.mypy]
strict = false
ignore_missing_imports = true
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
@tam17aki
tam17aki / ruff-sort-imports.el
Created June 29, 2024 07:23
Sort the order of imports in Python source code by using Ruff.
;;; ruff-sort-imports.el --- Sort import libraries of Python source via Ruff -*- lexical-binding: t; -*-
;; Copyright (C) 2024 Akira Tamamori
;; Copyright (C) 2023 Ville Skyttä
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
@tam17aki
tam17aki / phaseret_demo.py
Last active June 13, 2024 12:41
Demonstration script of phase reconstruction with PHASRET and oct2py.
# -*- coding: utf-8 -*-
"""Demonstration script of phase reconstruction with PHASRET and oct2py.
Copyright (C) 2024 by Akira TAMAMORI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
import numpy as np
import soundfile as sf
from oct2py import octave
from scipy import signal
WIN_LEN = 512
HOP_LEN = 128
FFT_LEN = 512
WINDOW = "hann"
IN_WAV = "ONOMATOPEE300_001.wav"
@tam17aki
tam17aki / GLU.py
Last active April 29, 2024 06:15
"Wrapper modules of PyTorch GLU.
# -*- coding: utf-8 -*-
"""Wrapper modules of Gated Linear Unit (GLU).
Copyright (C) 2024 by Akira TAMAMORI
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#!/usr/bin/env python3
# MIT License
# Copyright (C) 2024 by Akira TAMAMORI
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
;; 起動時間をメッセージバッファに表示
(add-hook 'after-init-hook
(lambda ()
(message "init time: %.3f sec"
(float-time (time-subtract after-init-time before-init-time)))))
;; ロードパスの設定
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; C-zを無効化
;; C-zを無効化
(global-unset-key "\C-z")
;; ロードパスを追加
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; theme
(if (display-graphic-p)
(load-theme 'solarized-light t))
;; (load-theme 'solarized-light t)
@tam17aki
tam17aki / gla.py
Last active December 27, 2023 07:15
Estimation of phase spectrum based on the Griffin-Lim algorithm.
"""Griffin-Lim algorithm.
Copyright (C) 2023 by Akira Tamamori
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
# -*- coding: utf-8 -*-
"""音声パワーと基本周波数をリアルタイムモニタリングする.
Copyright (C) 2023 by Akira TAMAMORI
Copyright (C) 2022 by Koji INOUE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell