Posts

Showing posts from April, 2019

MATLAB: signal processing chorus with sample

Image
function song = playSong(theVoices) fs = 8000; spp = 0.2;    %a zero vector with respect to the final pulse position and duration song = zeros(1, 321*spp*fs);    %cycling thought the different voices f or ii = 1:length(theVoices)        %cycling through each voice to build the song     for kk = 1:length(theVoices(ii).noteNumbers)        note = real(0.1*exp(1j*2*pi*(440*2^((theVoices(ii).noteNumbers(kk)- 49)/12))*((1/fs):(1/fs):            (theVoices(ii).durations(kk)*spp))));      %start and end pulses with regards to fs locstart = theVoices(ii).startPulses(kk)*1600;      locend = locstart + length(note) - 1;      song(locstart:locend) = song(locstart:locend) + note;    end end load 'handel.mat'; filename = 'lab3song5.wav'; soundsc(song, fs); audiowrite(filename, song, 8000); OUTPUT

VHDL: MIPS final project

Image
TOP library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.numeric_std.all; use work.MIPS_LIB.all; entity Mips is port (         clk             : in std_logic;         rst             : in std_logic;                sw_inport_data : in std_logic_vector(8 downto 0);          sw_inport_sel  : in std_logic;          sw_inport_wr   : in std_logic;   outport: out std_logic_vector(31 downto 0)      ); end Mips; architecture logic of Mips is    signal  PC_write   :   std_logic;    signal  I_or_D      :   std_logic;    signal  mem_write  :   std_logic;    signal mem_read    :   std_logic;    signal mem_reg   :   std_logic;    signal ir_write    :   std_logic;    signal is_signed  :   std_logic;    signal reg_write   :   std_logic;    signal jmp_link:   std_logic;    signal  reg_dst    :   std_logic;    signal alu_A    :   std_logic;    signal alu_B    :   std_logic_vector(1 downto 0);    signal PC_src      :   std_lo

Blender & Unity: Final Project demo

Image
Night at the Engineering Lab  final game demo Narrated by: William Dao

CPP: threading in LINUX showing output

Image
#include <iostream> #include <thread> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <future> #include <functional> void bar(std::future<int>& fut){ //get the promised variable //allocate memory for buffer int len = fut.get(); //get variable char * buff; //create buffer buff = (char*) malloc (len+1); //allocate memory if(buff==NULL){ //exit if no allocation exit(1); } for(int n=0;n<len;n++){ buff[n]=rand()%26+'a'; } buff[len]='\0'; std::cout<<"\nvalue: "<<buff<<'\n'; free(buff); //free memory } void foo(){ //get integer        //create promise //engage future //send future to new thread std::promise<int> malin; //create promise std::future<int> fut = malin.get_future(); //engage, make it so! std::thread th1 (bar, std::ref(fut)); //send future to thread int i,n; std::

Blender: first render workbench

Image

C: UART and CdS photocell

Image
/************************************** 3/28/2019 ADC for CdS photocell and user input  that provides voltage readings via UART ***************************************/ /***************INCLUDES***************/ #include <avr/io.h> #include <avr/interrupt.h> /***********INITIALIZATIONS************/ int16_t result; volatile  adc_conv_rdy = 0; uint8_t  low_byte; uint8_t  high_byte; #define LETTER 0x41 #define ZERO 0x30 #define CR 0x0D #define LF 0x0A #define ONE 0x31 #define TWO 0X32 /************FUNCTIONS*****************/ void adc_init(void); void tcc0_init(void); void usartd0_init(void); void usart_d0_out_char(char c); void output_voltage(int16_t result); /***************MAIN*******************/ int main(void){ tcc0_init(); adc_init(); usartd0_init(); PMIC.CTRL = PMIC_HILVLEN_bm; //enable sei(); while(1){ if( adc_conv_rdy=1 ) { //check if ready adc_conv_rdy=0; usart_d0_out_char(low_byte);

Blender: first render mini scene

UNDERWATER SCENE

Blender: first render sample shots

Image
COMPUTER ROOM HALLWAY STORAGE ROOM CLASS ROOM